import { formatYear, formatDate, formatBirthday } from '@/utils/format';

export default function(identity = 0) {
  const normalColumns = [
    {
      title: "姓名",
      dataIndex: "staffName",
      key: "staffName",
    },
    {
      title: '详情',
      dataIndex: 'staffId',
      key: 'staffId'
    },
    {
      title: "性别",
      dataIndex: "gender",
      key: "gender",
    },
    {
      title: "职级描述",
      dataIndex: "levelInfo",
      key: "levelDescription",
    },
    {
      title: "联系电话",
      dataIndex: "mobile",
      key: "mobile",
    },
    {
      title: "部门",
      dataIndex: "departmentInfo",
      key: "departmentName",
    },
    {
      title: "部门领导",
      dataIndex: "departmentInfo",
      key: "departmentLeader",
    }
  ];
  const authColums = [
    {
      title: "权限",
      dataIndex: "auth",
      key: "auth",
    },
    {
      title: "年龄",
      dataIndex: "idNumber",
      key: "age",
      customRender: ({ text }) => {
        return formatYear(text, 'age')
      }
    },
    {
      title: "入职时间",
      dataIndex: "onboardingTime",
      key: "onboardingTime",
      customRender: ({ text }) => {
        return formatDate(text, 'YYYY-MM-DD')
      }
    },
    {
      title: "学历",
      dataIndex: "educationType",
      key: "educationType",
    },
    {
      title: "婚姻状况",
      dataIndex: "isMarriage",
      key: "isMarriage",
    },
    {
      title: "出生日期",
      dataIndex: "idNumber",
      key: "birthday",
      customRender: ({ text }) => {
        return formatBirthday(text);
      }
    },
    {
      title: "银行卡号",
      dataIndex: "bankAccount",
      key: "bankAccount",
    },
    {
      title: "身份证号",
      dataIndex: "idNumber",
      key: "idNumber",
    },
    {
      title: "毕业院校",
      dataIndex: "educationSchool",
      key: "educationSchool",
    },
    {
      title: "绩效考核",
      dataIndex: "record",
      key: "assessment",
    },
    {
      title: "奖惩记录",
      dataIndex: "record",
      key: "rewardPunishRecord",
    },
    {
      title: "调薪记录",
      dataIndex: "record",
      key: "salaryAdjustment",
    },
  ];
  const colums = identity === 1 ? [...normalColumns, ...authColums] : normalColumns;
  return colums;
}